/**
 * Copyright (C) 2017 - 2020 https://github.com/joewee
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.bifrost.entity;

import com.bifrost.constant.BonusPointsUpdatedType;
import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author joewee
 * @version 1.0.0
 * @date 2018/6/12 13:08
 */
@Entity
@Table(name = "CRM_EXCEPTION_ORDER",indexes = {
        @Index(name = "ORDER_ID_TYPE",columnList = "ORDER_ID,TYPE",unique = true)
})
@NamedQuery(name = "CrmExceptionOrder.findAll", query = "SELECT c FROM CrmExceptionOrder c")
public class CrmExceptionOrder implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "ID", unique = true, nullable = false)
    private Long id;

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "CREATED_TIME")
    private Date createdTime=new Date();

    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "LAST_MODIFY_TIME")
    private Date lastModifyTime;

    @Column(name = "ORDER_ID",nullable = false)
    private Long orderId;

    @Column(name = "TYPE",nullable = false)
    @Enumerated(value = EnumType.STRING)
    private BonusPointsUpdatedType type;
    /**
     * 记录原始数据
     * */
    @Column(name = "DATA")
    @Lob
    @JsonIgnore
    private String data;

    @Column(name = "REMARK")
    private String remark;

    public CrmExceptionOrder() {
    }

    public CrmExceptionOrder(Long orderId, BonusPointsUpdatedType type, String data) {
        this.orderId = orderId;
        this.type = type;
        this.data = data;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getCreatedTime() {
        return createdTime;
    }

    public void setCreatedTime(Date createdTime) {
        this.createdTime = createdTime;
    }

    public Date getLastModifyTime() {
        return lastModifyTime;
    }

    public void setLastModifyTime(Date lastModifyTime) {
        this.lastModifyTime = lastModifyTime;
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public BonusPointsUpdatedType getType() {
        return type;
    }

    public void setType(BonusPointsUpdatedType type) {
        this.type = type;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
}
